package com.product.statemachine.order.event.enums;

/**
 * @author caoxingming
 */

public enum OrderEventEnums {


    CREATE_ORDER("CREATE_ORDER",OrderStateEnums.ORDER_NONEXISTENT,OrderStateEnums.ORDER_CREATED,"创建订单"),
    PAY_ORDER("PAY_ORDER",OrderStateEnums.ORDER_CREATED,OrderStateEnums.ORDER_PAYED,"支付订单"),
    CANCEL_ORDER("CANCEL_ORDER",OrderStateEnums.ORDER_CREATED,OrderStateEnums.ORDER_CLOSED,"取消订单"),
    DELIVERY_ORDER("DELIVERY_ORDER",OrderStateEnums.ORDER_PAYED,OrderStateEnums.ORDER_TO_DELIVERY,"订单待发货"),
    RECEIVE_ORDER("RECEIVE_ORDER",OrderStateEnums.ORDER_TO_DELIVERY,OrderStateEnums.ORDER_TO_RECEIVE,"订单待收货"),
    COMPLETE_ORDER("COMPLETE_ORDER",OrderStateEnums.ORDER_TO_RECEIVE,OrderStateEnums.ORDER_COMPLETED,"订单已完成"),
    DO_REVERSE_ORDER("DO_REVERSE_ORDER",OrderStateEnums.ORDER_COMPLETED,OrderStateEnums.ORDER_REVERSING,"订单发起售后"),
    CONFIRM_REVERSE_ORDER("CONFIRM_REVERSE_ORDER",OrderStateEnums.ORDER_REVERSING,OrderStateEnums.ORDER_REVERSED,"订单售后已完成"),
    CLOSE_REVERSED_ORDER("CLOSE_REVERSED_ORDER",OrderStateEnums.ORDER_REVERSED,OrderStateEnums.ORDER_CLOSED,"关闭已售后订单"),
    ;

    OrderEventEnums(String eventName, OrderStateEnums sourceState, OrderStateEnums targetState, String eventDesc) {
        this.eventName = eventName;
        this.sourceState = sourceState;
        this.targetState = targetState;
        this.eventDesc = eventDesc;
    }

    /**
     * 事件名称
     */
    private String eventName;

    /**
     * 事件发生前状态
     */
    private OrderStateEnums sourceState;

    /**
     * 事件发生后状态
     */
    private OrderStateEnums targetState;

    /**
     * 事件描述
     */
    private String eventDesc;

    /**
     * 事件是否变更状态码
     */
    private boolean changeState;

    public String getEventName() {
        return eventName;
    }

    public void setEventName(String eventName) {
        this.eventName = eventName;
    }

    public OrderStateEnums getSourceState() {
        return sourceState;
    }

    public void setSourceState(OrderStateEnums sourceState) {
        this.sourceState = sourceState;
    }

    public OrderStateEnums getTargetState() {
        return targetState;
    }

    public void setTargetState(OrderStateEnums targetState) {
        this.targetState = targetState;
    }

    public String getEventDesc() {
        return eventDesc;
    }

    public void setEventDesc(String eventDesc) {
        this.eventDesc = eventDesc;
    }

    @Override
    public String toString() {
        return "OrderEventEnums{" +
                "eventName='" + eventName + '\'' +
                ", sourceState=" + sourceState +
                ", targetState=" + targetState +
                ", eventDesc='" + eventDesc + '\'' +
                ", changeState=" + changeState +
                '}';
    }
}
